from owlready2 import *

onto_path.append('./owl')
# my_onto = get_ontology('onto.owl') # 这样写也可以，更简单
onto = get_ontology("http://test.org/onto/")



print('1. creating a general class axiom')
with onto:
    gca = GeneralClassAxiom(onto.Disorder & onto.has_location.some(onto.Heart)) # Left side
    gca.is_a.append(onto.CardiacDisorder) # Right side



print('2. Accessing general class axioms')
gcas = list(onto.general_class_axioms())
searched_left_side = onto.Disorder & onto.has_location.some(onto.Heart)
for gca in gcas:
    if gca.left_side == searched_left_side: print("Found!")